'use strict'

const assert = require('node:assert/strict')
const { describe, it } = require('tap').mocha

require('../../../../dd-trace/test/setup/core')

const parseTags = require('../../../src/utils/src/parse-tags')

describe('parseTags', () => {
  it('should parse tags to object', () => {
    const obj = {
      'a.0.a': 'foo',
      'a.0.b': 'bar',
      'a.1.a': 'baz'
    }

    assert.deepStrictEqual(parseTags(obj), {
      a: [{ a: 'foo', b: 'bar' }, { a: 'baz' }]
    })
  })

  it('should work with empty object', () => {
    assert.deepStrictEqual(parseTags({}), {})
  })
})
